<template>
  <div class="main">
    <el-input placeholder="请输入商品名称关键字" v-model="query" clearable>
      <el-button slot="append" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
    </el-input>
  </div>
</template>

<script>
export default {
  data() {
    return {
      query: ''
    }
  },
  created() {},
  methods: {
    search() {
      this.$router.push({
        path: '/productList',
        query: {
          query: this.query
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>
.main {
  display: flex;
  justify-content: center;
  margin-top: 15%;
  .el-input {
    width: 500px;
  }
}
</style>
